﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NikeSale.Ull
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //检测程序是否重复运行
            string strProcessName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
            if (System.Diagnostics.Process.GetProcessesByName(strProcessName).Length > 1)
            {
                MessageBox.Show("程序已经运行,不能重复打开！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
                return;
            }

            //检测数据库连接是否打开
            if (!Bll.DBSelect.Login.SqlserviceIsOpen())
            {
                MessageBox.Show("连接到数据库异常!程序启动失败", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new AddTypeForm());
            //Application.Run(new MainForm());
            //Application.Run(new RetGoodsForm());
            //Application.Run(new GoodsWarehousForm());
            Application.Run(new LoginForm());
            //Application.Run(new CashierForm());
        }
    }
}
